﻿using System;

namespace Infrastructure.CrossCutting.Configuration
{
    /// <summary>
    /// Configuration source interface for loading/viewing/saving settings. 
    /// </summary>
    public interface IConfigSource : IConfigSection
    {
        /// <summary>
        /// Event handler when the configuration store changes. 
        /// </summary>
        event EventHandler OnConfigSourceChanged;

        /// <summary>
        /// Name of the source. This cane be the file path. 
        /// </summary>
        /// <value>The source path.</value>
        string SourcePath { get; }

        void Init();

        /// <summary>
        /// Load the config settings from the underlying datasource. 
        /// </summary>
        void Load();

        /// <summary>
        /// Save the config settings to the underlying datasource. 
        /// </summary>
        void Save();

        void ChangeConfigItem(string configItemName, object value);
    }

}
